package client.adminGUI.user;

import java.io.IOException;
import client.backend.Connection;
import client.GUI.dashboard.AccountsPanel;
import client.adminGUI.GUIAdmin;
import client.adminGUI.user.*;
import client.backend.user.User;
import client.backend.account.Account;


import java.awt.event.*;
import java.awt.Dimension;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;

public class UserPanel extends JPanel implements ActionListener{
	private JPanel edit;
	private JPanel ordersPanel;
	
	private JScrollPane accountsPane;
	private JTable accountsTable;
	private User user;
	
	public static final int WIDTH = GUIAdmin.WIDTH;
	public static final int HEIGHT = GUIAdmin.HEIGHT-100;
	
	public static final int BOXWIDTH = 500;
	public static final int BOXHEIGHT = 300;
	public static final int LINEHEIGHT = 25;
	public static final int LEFTMARGIN = 10;
	public static final int COLWIDTH = 125;
	
	public UserPanel(int userid){
		try{
			user = new User(userid);
			this.setBounds(0,0,WIDTH,HEIGHT);
			this.setBackground(GUIAdmin.Background_Color);
			this.setLayout(null);
			edit=new EditPanel(user);
			//ordersPanel = new OrdersPanel(user);
			//this.add(ordersPanel);
			this.add(edit);
			
		} catch(IOException e){
			GUIAdmin.getInstance().setMessage("Error fetching user!");
			GUIAdmin.getInstance().hideUser();
			GUIAdmin.getInstance().displayUsers();
		}
	}

	
	public void actionPerformed(ActionEvent e) {
		GUIAdmin.getInstance().clearMessage();
    }
}
